package com.polaris.live.adapter.party

import android.view.View
import com.bumptech.glide.Glide
import com.polaris.live.R
import com.polaris.live.common.adapter.BaseBindingAdapter
import com.polaris.live.common.adapter.VBViewHolder
import com.polaris.live.databinding.AdapterFollowingRoomInfoBinding
import com.polaris.live.im.sfs.bean.live.ext.UserBasicVo
import com.polaris.live.utils.image.ImageUtils
import com.polaris.live.utils.image.normal
import com.polaris.live.widget.avatar.FrameImageUtils

/**
 * RoomInfoFollowAdapter
 *
 * @author Created by 天晴 on 2024/9/25/004 12:03
 */
class RoomInfoFollowAdapter : BaseBindingAdapter<AdapterFollowingRoomInfoBinding, UserBasicVo>() {

    init {
        addChildClickViewIds(R.id.av_fv)
    }

    override fun convert(holder: VBViewHolder<AdapterFollowingRoomInfoBinding>, item: UserBasicVo) {
        holder.vb.apply {
            Glide.with(context).load(ImageUtils.imgPathSmall(item.avatar)).normal().into(followItemHead)
            followItemNickName.text = item.nickname
            avFv.setFrameImage(FrameImageUtils.urlToFrameImageBean(item.avatarFrame))
            if (item.country?.isBlank() == true) {
                cvCountry.visibility = View.GONE
            } else {
                cvCountry.visibility = View.VISIBLE
                cvCountry.setCountry(item.country)
            }
            vipView.setVipLevel(item.vipLevel)
            widgetIdView.setId(item)
            sexView.setSexAndAge(item.sex, item.birthday)
            languageView.setLanguage(item.secondLanguage)
            myLevel.setRichsLevel(item.richs)
            myLevel2.setCharmsLevel(item.charms)
            llFlag.setLabel(item.label)
        }
    }

}